package com.abel.rabbitmq.mq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Author: Abel.lin
 * Date: Created in 2018/5/31 16:42
 * Company: Abel.Studio
 * Copyright: Copyright (c) 2017
 * Description:
 */
@Component
public class Consumer {
    private Logger log = LoggerFactory.getLogger(this.getClass());

    @RabbitListener(queues = RabbitConfig.NORMAL_QUEUE)
    public void normalHandler0(String message){
        log.info("normal1:{}", message);
    }
    @RabbitListener(queues = RabbitConfig.NORMAL_QUEUE)
    public void normalHandler1(String message){
        log.info("normal2:{}", message);
    }

    @RabbitListener(queues = RabbitConfig.FANOUT_QUEUE1)
    public void ps1Handler(String message){
        log.info("ps1:{}", message);
    }
    @RabbitListener(queues = RabbitConfig.FANOUT_QUEUE2)
    public void ps2Handler(String message){
        log.info("ps2:{}", message);
    }

    @RabbitListener(queues = RabbitConfig.ROUTING_QUEUE1)
    public void routing1Handler(String message){
        log.info("routing1:{}", message);
    }
    @RabbitListener(queues = RabbitConfig.ROUTING_QUEUE2)
    public void routing2Handler(String message){
        log.info("routing2:{}", message);
    }

    @RabbitListener(queues = RabbitConfig.TOPIC_QUEUE1)
    public void topic1Handler(String message){
        log.info("topic1:{}", message);
    }
    @RabbitListener(queues = RabbitConfig.TOPIC_QUEUE2)
    public void topic2Handler(String message){
        log.info("topic2:{}", message);
    }
    @RabbitListener(queues = RabbitConfig.TOPIC_QUEUE3)
    public void topic3Handler(String message){
        log.info("topic3:{}", message);
    }

}


